//
//  FKBusinessGiftBagCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/4/3.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKBusinessGiftBagCell.h"

@interface FKBusinessGiftBagCell ()

//@property (nonatomic, weak) UIImageView *picView;
//@property (nonatomic, weak) UILabel *titleLabel;
//@property (nonatomic, weak) UILabel *marketPriceLabel;
//@property (nonatomic, weak) UILabel *priceLabel;

@property (nonatomic, weak) UIImageView *giftView;

@end

@implementation FKBusinessGiftBagCell

- (void)setupSubviews
{
    [super setupSubviews];
    self.backgroundColor = [UIColor clearColor];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UIView *container = [[UIView alloc] init];
    [self.contentView addSubview:container];
    container.backgroundColor = [UIColor whiteColor];
    [container fk_viewCornerRadius:5 borderWidth:0 borderColor:nil];
    
    UIImageView *giftView = [[UIImageView alloc] init];
    [container addSubview:giftView];
    self.giftView = giftView;
    
//    UIImageView *picView = [[UIImageView alloc] init];
//    [container addSubview:picView];
//    self.picView = picView;
//
//    UILabel *titleLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
//    [container addSubview:titleLabel];
//    self.titleLabel = titleLabel;
//    titleLabel.numberOfLines = 2;
//
//    UILabel *marketPriceLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor999999];
//    [container addSubview:marketPriceLabel];
//    self.marketPriceLabel = marketPriceLabel;
//
//    UILabel *priceTitleLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333 text:@"大礼包价格"];
//    [container addSubview:priceTitleLabel];
//
//    UILabel *priceLabel = [UILabel fk_labelWithFont:fk_adjustFont(24) textColor:fkMainColor];
//    [container addSubview:priceLabel];
//    self.priceLabel = priceLabel;
//
//    UIButton *buyBtn = [UIButton fk_btnWithTarget:self action:@selector(buyBtnClicked) font:nil normalTitle:nil normalTitleColor:nil selectedTitle:nil selectedTitleColor:nil normalImg:nil selectedImg:nil bgImg:[UIImage imageNamed:@"business_buy"] selectedBgImg:nil];
//    [container addSubview:buyBtn];

    [container mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.right.offset(-12);
        make.top.bottom.offset(0);
    }];
    [giftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];
//    [picView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.width.height.offset(fk_adjustW(160));
//        make.left.offset(0);
//        make.centerY.offset(0);
//    }];
//    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.offset(fk_adjustW(20));
//        make.left.equalTo(picView.mas_right).offset(fk_adjustW(10));
//        make.right.offset(fk_adjustW(-15));
//    }];
//    [buyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.width.offset(fk_adjustW(100));
//        make.height.offset(fk_adjustW(36));
//        make.left.equalTo(picView.mas_right).offset(fk_adjustW(5));
//        make.bottom.offset(fk_adjustW(-6));
//    }];
//    [priceTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(titleLabel);
//        make.bottom.equalTo(buyBtn.mas_top).offset(fk_adjustW(-10));
//    }];
//    [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(priceTitleLabel.mas_right).offset(4);
//        make.right.lessThanOrEqualTo(titleLabel);
//        make.bottom.equalTo(priceTitleLabel);
//    }];
//    [marketPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.equalTo(titleLabel);
//        make.bottom.equalTo(priceLabel.mas_top).offset(fk_adjustW(-4));
//    }];
}

- (void)buyBtnClicked
{
    
}

- (void)setData:(id)data
{
    [super setData:data];
    
    if ([data isKindOfClass:[NSDictionary class]]) {
        [self.giftView sd_setImageWithURL:[NSURL URLWithString:data[@"gift_package_image"]] placeholderImage:kPlaceholder_1x1];
        
//        [self.picView sd_setImageWithURL:[NSURL URLWithString:data[@"img"]] placeholderImage:kPlaceholder_1x1];
//        self.titleLabel.text = data[@"title"];
//        self.priceLabel.text = fkFORMAT(@"￥%@", data[@"price"]);
//        self.priceLabel.attributedText = [self.priceLabel.text fk_addAttributeStyle:@"￥" color:[UIColor fk_colorWithHex:0xAC1A27] font:fk_adjustFont(12)];
//        self.marketPriceLabel.text = fkFORMAT(@"价值￥%@", data[@"marketprice"]);
//        [self.marketPriceLabel fk_addMiddleLine:fkColor999999];
    }
}

@end
